<!--售票员票款差异待协查-->
<template>
  <div class="cheZhanBKTZ el-card is-always-shadow el-card__body">
    <el-dialog
      title="日期设置"
      :visible.sync="dialogVisible"
      @close="closed"
      width="950px">
      <avue-crud
        ref="crud"
        :option="option"
        :data="data">
        <template slot-scope="scope" slot="accountTime">
          <el-date-picker
            v-model="scope.row.accountTime"
            type="date"
            :picker-options="{disabledDate(time) { return time.getTime() > Date.now();}}"
            placeholder="入账日期">
          </el-date-picker>
        </template>
      </avue-crud>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitSetDate">确 定</el-button>
      </div>
    </el-dialog>
</div>
</template>


<script>
    import {getForm, postForm} from '@/api/gen/gen'
    import moment from "moment";
    import {
      chezhan_IS_ADD_NOTICE,
      clearSelect,
      fenExYuangettoFixed, getChezhan_IS_ADD_NOTICE,
      getgetStationCodes,
      getLineCodes, getLineName, getStationName,
      getXieChaStatusFormat, setSearchFiledsEmpty,
      xieChaStatus,getchezhan_bukuan_status
    } from "../../../../../api/subwayRat/commonCheck";
    import {exportDataToExcel} from "../../../../../api/subwayRat/exportSelf";
    import {
      getSwAuStationShortList,
      setSwAuStationShortAccuntTime
    } from "../../../../../api/subwayRat/conductorDifferences/conductorTicketChaYiShenhe/cheZhanPKCY/cheZhanBKTZ";
   export default {
      components:{
      },
      data() {
            return {
              dialogVisible:true,
              listLoading: true,
              lineCodes:[],
              stationCodes:[],
              tvmCodes:[],
              selectKeys:[], //存放对像
              selectKeyVals:[], //存放值
              data: [],
              searchForm:{},
              page: {
                total: 0, // 总页数
                currentPage: 1, // 当前页数
                pageSize: 20, // 每页显示多少条,
                isAsc: false// 是否倒序
              },
              option:{ },
            }
        },
        created() {
        this.getOption();
        },
        methods: {
          setSearchFiledsEmpty,
          submitSetDate(){
            let th=this;
            setSwAuStationShortAccuntTime({rows:JSON.stringify(this.data)}).then(res=>{
              if(res.data.code==0){
                th.$message.success("操作成功！");
                th.closed();
                th.$parent.getList();
              }else{
                th.$message.error("操作失败！");
              }
            })
          },
          getList(rows) {           
            this.data =rows;
            
          },
          selectionChange(list){
            this.selectKeys=list;
            this.selectKeyVals=[];
            for(let i=0;i<list.length;i++){
              this.selectKeyVals.push(list[i].id);
            }
          },
          handleFilter(params, done) {
            Object.assign(this.searchForm,params);
            this.getList();
            done()
          },

          getOption(){
            let th=this;
            this.option={
              emptyBtn:false,
              editBtn:false,
              delBtn:false,
              addBtn:false,
              border: true,
              columnBtn:false,
              refreshBtn:false,
              index:true,
              indexLabel:'序号',
              page:true,
              align:'center',
              menu:false,
              menuWidth:150,
              menuAlign:'center',
              selection: false,
              reserveSelection:false,
              column:[{label:"线路",width: 100,
                "prop":"lineCode",type:'select',formatter: function(row, value , label, column){
              return getLineName(value);
            }},
                {label:"站点",width: 180,
                  "prop":"stationCode",type:'select',formatter: function(row, value , label, column){
              return getStationName(row.lineCode,value);
            }},
                {label:"收入日期",width:120,
                  "prop":"incomeTime",format:'yyyy-MM-dd',valueFormat:'yyyy-MM-dd',type:'date'},
                {label:"短款金额",
                  "prop":"shortAmount",formatter:function (row,v) {
                    return fenExYuangettoFixed(row,'shortAmount');
                  }},

                {label:"车站人员",width:160,
                  "prop":"conductorPersonName"},
                {label:"车站人员工号",width: 120,
                  "prop":"conductorJobNo"},
                {label:"通知状态",
                  "prop":"noticeState",type:'select',dicData:[{label:'是',value:1},{label:'否',value:0}],
                  formatter:function(row, value , label, column){
                  let state={1:'是',0:'否'};
                    return state[value];
                  }},
                {label:"补款状态", "prop":"isNotice",formatter:function (row,v) {
              return getchezhan_bukuan_status(v);
            }},
                {label:"补款时间",
                  "prop":"noticeTime",type:'date',format:'yyyy-MM-dd'},
                {label:"入账日期",
                  "prop":"accountTime",type:'date',format:'yyyy-MM-dd',slot:true,width:200},

              ]
            }
          },
          closed(){ //结账金额 sc 差额
            this.dialogVisible=false;
            this.$parent.isShowDia=false;
          }
        },
      mounted() {
        getLineCodes().then(res=>{ //获取线路
          this.lineCodes=res;
        });
      }
    }
</script>
<style lang="scss">

</style>
